<template>
	<view class="contain">
		<view class="title">
			{{info.title}}
		</view>
		<view class="pubisher">
			发布人&emsp;：{{info.publisher}}
		</view>
		<view class="pubisher">
			发布日期：{{info.datetime.slice(0,19).replace("T"," ")}}
		</view>
		<scroll-view class="content" scroll-y="true">
			<u-parse :content="info.content">

			</u-parse>

		</scroll-view>
	</view>
</template>

<script>
	import api from '@/api/index.js'; // 引入api

	export default {
		data() {
			return {
				info: {
					title: "好好学习，天天向上",
					content: "<h1>好好学习，天天向上</h1>",
					datetime: "2000-12-14 12:00:00",
					publisher: "董教授"
				}
			}
		},
		methods: {

		},
		onLoad(options) {
			// console.log(options)
			let id = options.id
			// 请求数据
			let token = uni.getStorageSync("token")
			api.getNotiById(token, id).then(res => {
				if (res.code === 1) {
					this.info = res.data
				} else {
					uni.showModal({
						content: res.errors
					})
				}
			}).catch(err => {
				console.log(err)
			});
		}
	}
</script>

<style lang="less">
	.contain {
		.title {
			height: 100px;
			line-height: 100px;
			background-color: #eee;
			text-align: center;
			font-size: 15px;
			
		}

		.pubisher {
			height: 30px;
			line-height: 30px;
			background-color: #fff;
			// border: #222222 1px solid;
		}

		.content {
			border: #EEEEEE 5px solid;
			height: calc(100vh - 215px);
		}
	}
</style>
